#ifndef ELEMENTS_ITEM_HISTORY_H
#define ELEMENTS_ITEM_HISTORY_H

#include "common/more/time.h"

#include "element.h"

namespace Elements
{

struct ItemHistory : public Element
{
    ItemHistory() = default;
    ItemHistory(const ItemHistory& other);

    // -- Интерфейс элемента -- //

    virtual bool isSame(Element* const other) const override;

    virtual Common::Json toJson() const override;
    virtual void fromJson(const Common::Json& json) override;

    virtual Element* clone() const override;
    virtual ElementType elementType() const override;

    // -- Интерфейс данных -- //

    unsigned itemId() const;
    void setItemId(unsigned value);

    unsigned userId() const;
    void setUserId(unsigned value);

    std::time_t timestamp() const;
    void setTimestamp(const std::time_t& value);

    std::string diff() const;
    void setDiff(const std::string& value);

private:
    unsigned m_itemId = 0;
    unsigned m_userId = 0;
    std::time_t m_timestamp = 0;
    std::string m_diff;

};

typedef std::shared_ptr<ItemHistory> ItemHistoryPtr;
typedef std::vector<ItemHistoryPtr> ItemHistories;

} // namespace Elements

#endif // ELEMENTS_ITEM_HISTORY_H
